package com.hospital.workstation.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.hospital.common.core.domain.R;
import com.hospital.workstation.domain.vo.TimerShaftVo;
import com.hospital.workstation.service.IHisMedicalOrdersService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用药时间轴
 *
 * @author whb
 * @date 2023-03-31
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/workstation/shaft")
public class TimerShaftController {
    private final IHisMedicalOrdersService hisMedicalOrdersService;

    /**
     * 查询用药时间轴数据
     *
     * @param medicalRecordNo 病历号
     * @param orderCategory   医嘱类别（1西药 2中成药 3中药饮片）
     * @return
     */
    //@SaCheckPermission("workstation:shaft:query")
    @GetMapping("/{medicalRecordNo}/{orderCategory}")
    public R<TimerShaftVo> queryTimerShaft(@PathVariable Integer medicalRecordNo, @PathVariable String orderCategory) {
        return hisMedicalOrdersService.queryTimerShaft(medicalRecordNo, orderCategory);
    }

    /**
     * 分组显示用药时间轴数据
     *
     * @param medicalRecordNo 病历号
     * @param category        类别（1长嘱 2临嘱 3中药饮片）
     * @return
     */
    @GetMapping("group/{medicalRecordNo}/{category}")
    public R<TimerShaftVo> queryTimerShaftShowGroup(@PathVariable Integer medicalRecordNo, @PathVariable String category) {
        return hisMedicalOrdersService.queryTimerShaftShowGroup(medicalRecordNo, category);
    }
}
